<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>层级轮播图</title>
    <style>
        * {
            margin: 0;
            padding: 0;

        }
        .box {
            width: 650px;
            height: 250px;
            margin: 100px auto;
            position: relative;
            overflow: hidden;
        }
        img {
            vertical-align: top;
        }
        .box > ul ,.box > ol{
            list-style: none;
        }
        .box>ul{
            height: 100%;
            position: relative;
            z-index: 1;
        }
        .box>ul>li {
            position: absolute;
            top: 0;
            left: 0;
        }
        .box > ol{
            position: absolute;
            right: 10px;
            bottom: 10px;
            z-index: 2;
        }
        .box > ol >li{
            float: left;
            width: 30px;
            height: 30px;
            border: 2px solid white;
            margin-left: 5px;
            background-color: #aaa;
            text-align: center;
            line-height: 30px;
            cursor: pointer;
        }
        .box > ol >li.active{
            border-color: orange;
            color: orange;
            padding: 2px;
            margin-top: -4px;
        }
    </style>
    <script src="../lib/jquery-3.4.1.js"></script>
    <script>
        $(function(){
            var zI = 1;
            $("ol>li").mouseenter(function(){
                zI++;
                $(this).addClass("active").siblings().removeClass("active");
                $("ul>li").eq($(this).index()).css({
                    left:"650px",
                    "zIndex":zI
                }).stop().animate({
                    left:0
                },1000)
            });
        })
    </script>
</head>
<body>
    <div class="box">
        <ul>
            <li style="z-index: 1;"><img src="./imgs/01.jpg" alt=""></li>
            <li><img src="./imgs/02.jpg" alt=""></li>
            <li><img src="./imgs/03.jpg" alt=""></li>
            <li><img src="./imgs/04.jpg" alt=""></li>
            <li><img src="./imgs/05.jpg" alt=""></li>
        </ul>
        <ol>
            <li class="active">1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
            <li>5</li>
        </ol>
    </div>
</body>
</html>